package com.test.invoke;

import com.test.java.Java_0;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * =============================================================
 * Version          Author          Date            Description
 * 1.0             01144895        2018/1/31             创建
 * =============================================================
 */
public class Invoke_1
{

    public static void main(String[] args)
            throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException,
                   InstantiationException
    {
        //如何获取一个对象的反射类Class
        String s = "test";
        Class<?> c0 = s.getClass();
        Class<?> c1 = Class.forName("java.lang.String");
        Class<?> c2 = String.class;

        Class c3 = Java_0.class;
        Method m = c3.getMethod("radixChange", new Class[]{int.class, int.class, String.class});
        System.out.println(m.invoke(c3.newInstance(), new Object[]{10, 2, "30"}));
        System.out.println(((Java_0) c3.newInstance()).radixChange(10, 2, "50"));
    }
}
